package nc.ui.uif2.actions;

import java.awt.event.ActionEvent;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.sm.login.ClientAssistant;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.UIState;
import nc.ui.uif2.editor.BillForm;
import nc.ui.uif2.model.AbstractAppModel;

public class AddLineAction extends NCAction
{
  private static final String ICON_PATH = "/images/toolbar/icon2/addline.gif";
  private static final long serialVersionUID = 4947342009924551006L;
  private AbstractAppModel model;
  private BillForm cardpanel;

  public AddLineAction()
  {
    ActionInitializer.initializeAction(this, 11);
    putValue("SmallIcon", ClientAssistant.loadImageIcon("/images/toolbar/icon2/addline.gif"));
  }

  public void doAction(ActionEvent e)
    throws Exception
  {
    this.cardpanel.getBillCardPanel().addLine();
  }

  protected boolean isActionEnable()
  {
    return (this.model.getUiState() == UIState.ADD) || (this.model.getUiState() == UIState.EDIT);
  }
  public AbstractAppModel getModel() {
    return this.model;
  }
  public void setModel(AbstractAppModel model) {
    this.model = model;
    model.addAppEventListener(this);
  }
  public BillForm getCardpanel() {
    return this.cardpanel;
  }
  public void setCardpanel(BillForm cardpanel) {
    this.cardpanel = cardpanel;
  }
}